<template>
  <!-- 下部分 -->
  <div class="footer">
    <div @click="ok">
      <div class="footer-row">
        <span style=" background-color: #c8ae64; color: #fff; border-radius: 3px; font-size: 13px; padding: 2px 4px; margin-right: 4px; ">{{item.category}}</span>
        <span
          style="
            color: #9d9e9f;
            font-size: 13px;
            padding: 1px 4px;
            margin-right: 4px;
          "
          >{{item.title}}</span
        >
        <span :style="{color: (item.type.value === 'yiwancheng') ? '#9d9e9f' : '#99C455', float: 'right', 'font-size': '13px'}"
                  >{{ item.type.label }}</span
                >
      </div>
      <div class="footer-separator"></div>
      <div class="footer-head">
        <span>{{item.subTitle}}</span>
      </div>
      <div class="footer-row"> <span>{{item.jihuashijian}} </span> </div>
      <div class="footer-row"> <span>{{item.jifangbianhao}} </span> </div>
      <div class="footer-row"> <span>{{item.jifangdizhi}} </span> </div>
      <div class="footer-row"> <span>{{item.zhenghaogongsi}} </span> </div>
      <div class="footer-separator"></div>
    </div>
    <div class="bottom-bar">
      <div class="left-section" @click="qdSure">
        <!-- 假设你有一个图标组件或图标字体 -->
        <img
          src="@/assets/xiangmujindu/icon_phone.png"
          style="width: 22px; margin-right: 3px"
          alt=""
        />
        <span>售前经理</span>
      </div>
      <template v-if="item.type.label !== '已完成'">
        <div class="right-section">
          <span class="bar-left" @click="goToPage('paigongpaiban')">派工</span>
          <span class="bar-right" @click="goToPage('jiedan')">结单</span>
        </div>
      </template>
    </div>

    
    <!-- 联系确认 -->
    <div v-if="qdSureVisi" style="position: fixed;top: 0;left: 0; width: 100vw;height: 100vh;background-color: rgba(0, 0, 0, 0.5);">
      <div class="bg_alert" style="background-color: #fff;margin: 56% auto;width: 80vw;text-align: center;padding-top: 20px;border-radius: 10px;">
        <div style="color: #000;font-weight: bold;font-size: 18px;">联系确认</div>
        <div style="padding: 18px 13px;border-bottom: 1px solid #F4F5F9;font-size: 14px;line-height: 22px;">
          <table style="width: 100%;border-collapse: collapse;">
            <tr>
              <td style="color: #9D9E9F;text-align: center;">确认发起电话联系？</td>
            </tr>
          </table>
        </div>
        <div style="display: flex;justify-content: space-around;height: 46px;line-height: 46px;">
          <p style="width: 50%; border-right: 1px solid #F4F5F9;" @click="qdSureVisi = false">取消</p>
          <p style="width: 50%;color: #739F2F;" @click="qdSure">确认</p>
        </div>
      </div>
    </div>
  </div>
</template>
<script>

export default {
  props: {
    item: {
      type: Object,
      default: () => ({})
    },
  },
  data() {
    return {
      qdSureVisi: false,
    }
  },
  methods: {
    ok () {
      this.$emit('ok')
    },
     goToPage(page) {
      this.$router.push({ name: page })
    },
    qdSure () {
      this.qdSureVisi = false;
      this.qdSureToastVisi = true;
      this.qdSureToastTitle = this.Index <= 0 ? '恭喜您，抢单成功！' : '很遗憾，该工单已被其他人抢'

      setTimeout(() => {
        this.qdSureToastVisi = false
        this.Index = -1
      }, 2000);
    },
  }
}
</script>
<style scoped>

.footer {
  padding: 12px;
  background-color: #FBFCFF;
  border-radius: 16px;
  border: 1px solid #F1F2F7;
  box-sizing: border-box;
  margin: 13px 12px;
}

.footer-row {
  font-size: 14px;
  padding: 4px 0;
  color:#9D9E9F;
}

.footer-separator {
  height: 1px;
  background-color: #F4F5F9;
  margin: 11px 0;
}

.footer-head {
  margin-bottom:5px;
  font-size: 14px;
  width: 100%;
  font-weight: bold;
}

.bottom-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
  max-width: 600px; /* 与.header的最大宽度保持一致 */
  margin: 0 auto;
}

.bottom-bar .left-section {
  display: flex;
  align-items: center;
}

.bottom-bar .left-section .icon-money-manager {
  /* 假设你使用的是图标字体，这里设置字体和大小 */
  font-size: 24px;
  margin-right: 8px;
  color: #76983a;
}

.bottom-bar .left-section span {
  font-size: 14px;
  color: #242627;
}

.bottom-bar .right-section {
  display: flex;
  gap: 8px; /* 按钮之间的间距 */
}

.bottom-bar button {
  padding: 8px 16px;
  font-size: 13px;
  color: #fff;
  border-radius: 4px;
  cursor: pointer;
      width: 80px;
    height: 38px;
}
.bar-left {
  background-color: #fff !important;
  border: 1px solid #739F2F !important;
  color: #76983a !important;
  padding: 6px 22px;
  border-radius: 3px;
}

.bar-right {
  background-color: #99C455;
    padding: 6px 22px;
  border-radius: 3px;
  color:#FFFFFF !important;
}

.bottom-bar button:hover {
  background-color: #648030; /* 可选：添加悬停效果 */
}



/* 弹窗 */
.bg_alert {
  background-image: url('@/assets/xiangmujindu/bg_alert.png');
  background-position: top 0% left 0;
  background-size: 100% 40%;
  background-repeat: no-repeat;
}
</style>